商户订单号查询
商户可以通过查询订单接口主动查询订单状态,完成下一步的业务逻辑。查询订单状态可通过微信支付订单号或商户订单号两种方式查询
| 请求参数 | 类型 | 描述 |
|---|---|---|
| out_trade_no | string | 商户订单号 |
| query | object | 声明请求的查询参数 |
| sp_mchid | string | 服务商户号 |
| sub_mchid | string | 子商户号 |
php
$instance->v3->pay->partner->transactions->outTradeNo->_out_trade_no_->getAsync([
'out_trade_no' => '1217752501201407033233368018',
'query' => [
'sp_mchid' => '1230000109',
'sub_mchid' => '1900000109',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance->chain('v3/pay/partner/transactions/out-trade-no/{out_trade_no}')->getAsync([
'out_trade_no' => '1217752501201407033233368018',
'query' => [
'sp_mchid' => '1230000109',
'sub_mchid' => '1900000109',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance['v3/pay/partner/transactions/out-trade-no/{out_trade_no}']->getAsync([
'out_trade_no' => '1217752501201407033233368018',
'query' => [
'sp_mchid' => '1230000109',
'sub_mchid' => '1900000109',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$response = $instance->v3->pay->partner->transactions->outTradeNo->_out_trade_no_->get([
'out_trade_no' => '1217752501201407033233368018',
'query' => [
'sp_mchid' => '1230000109',
'sub_mchid' => '1900000109',
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance->chain('v3/pay/partner/transactions/out-trade-no/{out_trade_no}')->get([
'out_trade_no' => '1217752501201407033233368018',
'query' => [
'sp_mchid' => '1230000109',
'sub_mchid' => '1900000109',
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance['v3/pay/partner/transactions/out-trade-no/{out_trade_no}']->get([
'out_trade_no' => '1217752501201407033233368018',
'query' => [
'sp_mchid' => '1230000109',
'sub_mchid' => '1900000109',
],
]);
print_r(json_decode((string) $response->getBody(), true));| 返回字典 | 类型 | 描述 |
|---|---|---|
| sp_appid | string | 服务商公众号ID |
| sp_mchid | string | 服务商户号 |
| sub_appid | string | 子商户公众号ID |
| sub_mchid | string | 子商户号 |
| transaction_id | string | 微信支付订单号 |
| trade_type | string | 交易类型JSAPI | NATIVE | APP | MICROPAY | MWEB | FACEPAY 枚举值之一 |
| trade_state | string | 交易状态SUCCESS | REFUND | NOTPAY | CLOSED | REVOKED | USERPAYING | PAYERROR 枚举值之一 |
| trade_state_desc | string | 交易状态描述 |
| bank_type | string | 付款银行 |
| success_time | string | 支付完成时间 |
| attach | string | 附加数据 |
| out_trade_no | string | 商户订单号 |
| amount | object | 用户支付金额 |
| payer_total | integer | 用户支付金额 |
| payer_currency | string | 用户支付币种 |
| total | integer | 总金额 |
| currency | string | 货币类型 |
| scene_info | object | 场景信息 |
| device_id | string | 商户端设备号 |
| payer | object | 支付者 |
| sp_openid | string | 用户服务标识 |
| sub_openid | string | 用户子标识 |
| promotion_detail | object[] | 优惠功能 |
| coupon_id | string | 券ID |
| name | string | 优惠名称 |
| scope | string | 优惠范围 |
| type | string | 优惠类型 |
| amount | integer | 优惠券面额 |
| stock_id | string | 活动ID |
| wechatpay_contribute | integer | 微信出资 |
| merchant_contribute | integer | 商户出资 |
| other_contribute | integer | 其他出资 |
| currency | string | 优惠币种 |
| goods_detail | object[] | 单品列表 |
| goods_id | string | 商品编码 |
| quantity | integer | 商品数量 |
| unit_price | integer | 商品单价 |
| discount_amount | integer | 商品优惠金额 |
| goods_remark | string | 商品备注 |